//
//  HTHttpRequestManager.m
//  TruckDriver
//
//  Created by Ting Han on 2017/10/19.
//  Copyright © 2017年 Ting Han. All rights reserved.
//

#import "HTHttpRequestManager.h"
#import "NetWorkCall.h"

@implementation HTHttpRequestManager

//检查新版本
+ (void)checkNewVersionSuccess:(nullable void (^)(id _Nullable responseObject))success failure:(nullable void (^)(NSError * _Nonnull error))failure{
    DBLog(@"检查新版本：%@",requestCargoversion);
    [NetWorkCall getRequestWithURL:requestCargoversion param:nil success:^(id responseObject) {
        if (success) {
            success(responseObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}

#pragma mark ----
//请求验证码
+ (void)requestSecurityCodeWithPhoneNum:(NSString *)phoneNum success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSDictionary *params = @{@"phone" : phoneNum};
    if (phoneNum == nil || phoneNum.length <= 0) {
        if (failure) {
            NSError *error = nil;
            failure(error);
        }
        return;
    }
    [NetWorkCall getRequestWithURL:requestSecurityCode param:params success:^(id responseObject) {
        if (success) {
            success(responseObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
//登陆请求
+ (void)requestLoginWithPhoneNum:(NSString *)phoneNum withSecurityCode:(NSString *)code success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    if (phoneNum == nil || phoneNum.length == 0 || code == nil || code.length == 0) {
        if (failure) {
            NSError *error = nil;
            failure(error);
        }
        return;
    }
    NSDictionary *params = @{@"phone":phoneNum,@"yzm":code};
    [NetWorkCall getRequestWithURL:requestlogin param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}


#pragma mark --- 发货
//发布货源
+ (void)requestDeliverGoodsWithFromaddress:(nullable NSString *)fromAddress toaddress:(nullable NSString *)toAddress fromProvince:(nullable NSString *)fromProvince toProvince:(nullable NSString *)toProvince cargotype:(nullable NSString *)cargotype lenght:(nullable NSString *)lenght lengthtype:(nullable NSString *)lengthtype weight:(nullable NSString *)weight utit:(nullable NSString *)utit pricers:(nullable NSString *)pricers strattime:(nullable NSString *)strattime paytype:(nullable NSString *)paytype addtype:(nullable NSString *)addtype remark:(nullable NSString *)remark boostime:(nullable NSString *)boostime iscity:(nullable NSString *)iscity isworkes:(nullable NSString *)isworkes goodstype:(nullable NSString *)goodstype  success:(nullable void (^)(id _Nullable responseObject))success failure:(nullable void (^)(NSError * _Nonnull error))failure{
    
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"fromaddress":fromAddress
                              ,@"toaddress":toAddress
                              ,@"cargotype":cargotype
                              ,@"lenght":lenght
                              ,@"lengthtype":lengthtype
                              ,@"weight":weight
                              ,@"utit":utit
                              ,@"pricers":pricers
                              ,@"strattime":strattime
                              ,@"paytype":paytype
                              ,@"addtype":addtype
                              ,@"remark":remark
                              ,@"boostime":boostime
                              ,@"iscity":iscity
                              ,@"isworkes":isworkes
                              ,@"goodstype":goodstype
                              ,@"fromprovice":fromProvince
                              ,@"toprovice":toProvince
                             };
    DBLog(@"发货的时候上传的时间：%@",strattime);
    [NetWorkCall postRequestWithURL:requestDeliverGoods param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestDeliverGoodsListWithState:(NSString *)state success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"state":state
                             };
    DBLog(@"发货列表：%@?token=%@&state=%@",requestDeliverList,token,state);
    [NetWorkCall getRequestWithURL:requestDeliverList param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        
        if (failure) {
            failure(error);
        }
        
    }];
}
+ (void)requestDeliverHolderInfoWithProductid:(NSString *)productid success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"productid":productid
                             };
    DBLog(@"货源信息：%@?token=%@&productid=%@",requestDeliverHolder,token,productid);
    [NetWorkCall getRequestWithURL:requestDeliverHolder param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestDeliverStateChangeWithProduceid:(NSString *)produceid state:(NSString *)state success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"productid":produceid
                             ,@"state":state
                             };
    DBLog(@"更改状态：%@?token=%@&productid=%@&state=%@",requestDeliverStateChange,token,produceid,state);
    [NetWorkCall getRequestWithURL:requestDeliverStateChange param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestDeliverGoodsFrequencyWithSuccess:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             };
    DBLog(@"常发货源：%@?token=%@",requestDeliverFrequently,token);
    [NetWorkCall getRequestWithURL:requestDeliverFrequently param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestDeliverGoodsDeleteWithWithProductid:(NSString *)productid success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"productid":productid
                             };
    [NetWorkCall getRequestWithURL:requestDeliverFrequentlyDelete param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestDeliverGoodsUsedWithProductid:(NSString *)productid success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"productid":productid
                             };
    [NetWorkCall getRequestWithURL:requestDeliverGoodsUsed param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestDeliverGoodsInfoWithProductid:(NSString *)productid success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"productid":productid
                             };
    [NetWorkCall getRequestWithURL:requestDeliverInfo param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}

#pragma mark --- 常用车辆部分
+ (void)requestTruckAddWithCarid:(NSString *)carid success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
      NSString *token = [HTMUserDefaultUtil readUserToken];
    if (carid == nil || carid.length <= 0 || token == nil || token.length <= 0) {
        if (failure) {
            NSError *error = nil;
            failure(error);
        }
        return;
    }
    NSDictionary *params = @{@"token":token
                             ,@"carid":carid
                             };
    DBLog(@"%@?token=%@&carid=%@",requestTruckAdd,token,carid);
    [NetWorkCall getRequestWithURL:requestTruckAdd param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestTruckListWithCarstate:(NSString *)carstate length:(NSString *)length cargotype:(NSString *)cargotype state:(NSString *)state Success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"carstate":carstate
                             ,@"length":length
                             ,@"cargotype":cargotype
                             ,@"state":state
                             };
    DBLog(@"%@?token=%@&carstate=%@&length=%@&cargotype=%@&state=%@",requestTruckList,token,carstate,length,cargotype,state);
    [NetWorkCall getRequestWithURL:requestTruckList param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestTruckListMapWithCarstate:(NSString *)carstate length:(NSString *)length cargotype:(NSString *)cargotype state:(NSString *)state success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    if (carstate == nil || carstate.length <= 0) {
        NSError *error = nil;
        failure(error);
        return;
    }
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"carstate":carstate
                              ,@"length":length
                              ,@"cargotype":cargotype
                              ,@"state":state
                             };
    [NetWorkCall getRequestWithURL:requestTruckListMap param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}

+ (void)requestTruckDeleteWithCarid:(NSString *)carid success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"carid":carid
                             };
   
    [NetWorkCall getRequestWithURL:requestTruckDelete param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestTruckDriverWithType:(NSString *)type phone:(NSString *)phone success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"type":type
                             ,@"phone":phone
                             };
    [NetWorkCall getRequestWithURL:requestTruckDriver param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
//司机主页信息
+ (void)requestTruckDriverInfoWithDriverid:(NSString *)driverid success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"driverid":driverid
                             };
    DBLog(@"司机信息：%@?token=%@&driverid=%@",requestTruckDriverInfor,token,driverid);
    [NetWorkCall getRequestWithURL:requestTruckDriverInfor param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
//司机信息
+ (void)requestTruckDriverCarInfoWithDriverid:(NSString *)driverid success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
     NSString *token = [HTMUserDefaultUtil readUserToken];
    if (driverid == nil || driverid.length <= 0 || token == nil || token.length <= 0) {
        if (failure) {
            NSError *error = nil;
            failure(error);
        }
    }
    NSDictionary *params = @{@"token":token
                             ,@"carid":driverid
                             };
    [NetWorkCall getRequestWithURL:requestTruckDriverCarInfo param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
#pragma mark --- 订阅线路
+ (void)requestOrderlineListSuccess:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    if (token == nil || token.length <= 0) {
        return;
    }
    NSDictionary *params = @{@"token":token};
    [NetWorkCall getRequestWithURL:requestOrderlineList param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        
        if (failure) {
            failure(error);
        }
        
    }];
}
+ (void)requestOrderlineAddWithFromAddress:(NSString *)fromAddress withToAddress:(NSString *)toAddress success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"from":fromAddress
                             ,@"to":toAddress
                             };
    [NetWorkCall postRequestWithURL:requestOrderlineAdd param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestOrderlineDeleteWithId:(NSString *)withId success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token,@"id":withId};
    [NetWorkCall getRequestWithURL:requestOrderlineDelete param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestOrderlineSearchWithId:(NSString *)withId WithPage:(NSString *)page success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"cargobooksid":withId
                             ,@"page":page
                                };
    DBLog(@"货源详情byId：%@?token=%@&cargobooksid=%@&page=%@",requestOrderlineSearch,token,withId,page);
    [NetWorkCall getRequestWithURL:requestOrderlineSearch param:params success:^(id responeObject) {
        
        if (success) {
            success(responeObject);
        }
        
    } failure:^(NSError *error) {
        
        if (failure) {
            failure(error);
        }
        
    }];
}
#pragma mark --- 货源搜索
//货源搜索
+ (void)requestGoodsSearchWithStarname:(NSString *)starname endname:(NSString *)endname length:(NSString *)length cartype:(NSString *)cartype cargotype:(NSString *)cargotype page:(NSString *)page success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    if (starname == nil || starname.length <= 0) {
        NSError *error = nil;
        failure(error);
        return;
    }
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"from":starname
                             ,@"to":endname
                             ,@"length":length
                             ,@"cargotype":cargotype
                             ,@"page":page
                             };
    [NetWorkCall getRequestWithURL:requestGoodsSearch param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        
        if (failure) {
            failure(error);
        }
    }];
}

//货源详情
+ (void)requestGoodsDetialWithProductid:(NSString *)productid success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    if (token == nil || token.length <= 0 || productid == nil || productid.length <= 0) {
        NSError *error = nil;
        failure(error);
        return;
    }
    NSDictionary *params = @{@"token":token
                             ,@"productid":productid
                             };
    DBLog(@"货源详情：%@?token=%@&productid=%@",requestGoodsDetial,token,productid);
    [NetWorkCall getRequestWithURL:requestGoodsDetial param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}


//货主资料
+ (void)requestHolderInforWithCargoid:(NSString *)cargoid success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"cargoid":cargoid
                             };
    [NetWorkCall getRequestWithURL:requestHolderInfo param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}

#pragma mark --- 运单
+ (void)requestWaybillListWithState:(NSString *)state page:(NSString *)page success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"state":state
                             ,@"page":page
                             };
    [NetWorkCall getRequestWithURL:requestWaybillList param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestWaybillComformReceivedWithId:(NSString *)withid success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"id":withid
                             };
    [NetWorkCall getRequestWithURL:requestWaybillConformReceived param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestWaybillDetialWithOrderid:(NSString *)orderid success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"orderid":orderid
                             };
    DBLog(@"获取到运单详情：%@?token=%@&orderid=%@",requestWaybillDetial,token,orderid);
    [NetWorkCall getRequestWithURL:requestWaybillDetial param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestWaybillCommentWithOrderid:(NSString *)orderid scroller:(NSString *)scroller impersson:(NSString *)impersson success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"orderid":orderid
                             ,@"scroller":scroller
                             ,@"impersson":impersson
                             };
    [NetWorkCall getRequestWithURL:requestWaybillComment param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestWaybillCancleWithOrderid:(NSString *)orderid contenid:(NSString *)contenid success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"orderid":orderid
                             ,@"contenid":contenid
                             };
    [NetWorkCall getRequestWithURL:requestWaybillCancle param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestWaybillComformWithOrderid:(NSString *)orderid success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"orderid":orderid
                             };
    [NetWorkCall getRequestWithURL:requestWaybillHolderConform param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
#pragma mark --- 个人信息
+ (void)requestUserRegisterWithName:(NSString *)name carid:(NSString *)carid companyname:(NSString *)companyname addres:(NSString *)addres addressinfor:(NSString *)addressinfor licence:(NSString *)licence licenceno:(NSString *)licenceno success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"name":name
                              ,@"carid":carid
                              ,@"companyname":companyname
                              ,@"addres":addres
                              ,@"addressinfor":addressinfor
                              ,@"licence":licence
                              ,@"licenceno":licenceno
                             };
    DBLog(@"认证接口：licence:%@",licence);
    [NetWorkCall getRequestWithURL:requestUserRegister param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestUploadPictureWithType:(nullable NSString *)type image:(UIImage *_Nullable)image success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"type":type
                             };
    [NetWorkCall uploadImageWithArray:@[image] url:requestUploadUserspic fileName:@"img.jpg" names:@[@"image"] param:params progress:^(int64_t bytesProgress, int64_t totalProgress) {
        
    } success:^(id responseObject) {
        if (success) {
            success(responseObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
    
}
+ (void)requestUserInfosuccess:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             };
    DBLog(@"个人信息：%@?token=%@",requestUserInfo,token);
    [NetWorkCall getRequestWithURL:requestUserInfo param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestUserInfoDetialsuccess:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             };
    DBLog(@"详细信息：%@?token=%@",requestUserInfoDetial,token);
    [NetWorkCall getRequestWithURL:requestUserInfoDetial param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}

#pragma mark --- 注册通知
+ (void)requestNotificationRegisterWithType:(NSString *)type regitid:(NSString *)regitid success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    if (token == nil || token.length <= 0) {
        if (failure) {
            NSError *error = nil;
            failure(error);
        }
        return;
    }
    NSDictionary *params = @{@"token":token
                             ,@"type":type
                             ,@"regitid":regitid
                             };
    [NetWorkCall getRequestWithURL:requestNotificationRegister param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}

+ (void)requestUserMessageListWithSuccess:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             };
    [NetWorkCall getRequestWithURL:requestUserMessage param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestUploadAddressWithAddress:(NSString *)address lat:(NSString *)lat lng:(NSString *)lng success:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    if (token == nil || token.length <= 0 ||address == nil || address.length <= 0 || lat == nil || lat.length <= 0 ||lng == nil || lng.length <= 0) {
        if (failure) {
            NSError *error = nil;
            failure(error);
        }
        return;
    }
    NSDictionary *params = @{@"token":token
                             ,@"address":address
                             ,@"lat":lat
                             ,@"lng":lng
                             };
    [NetWorkCall getRequestWithURL:requestPostAddress param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}
+ (void)requestGetAddressListWithCarid:(nullable NSString *)carid Success:(nullable void (^)(id _Nullable responseObject))success failure:(nullable void (^)(NSError * _Nonnull error))failure{
    NSString *token = [HTMUserDefaultUtil readUserToken];
    NSDictionary *params = @{@"token":token
                             ,@"carid":carid
                             };
    DBLog(@"定位列表：%@?token=%@&carid=%@",requestGetAddress,token,carid);
    [NetWorkCall getRequestWithURL:requestGetAddress param:params success:^(id responeObject) {
        if (success) {
            success(responeObject);
        }
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}

@end
